<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<style>
			* {
				margin: 0px;
				padding: 0px;
			}
		</style>
	</head>

	<body>
		<script>
			function fish(x, y, w, h, count, bg, sudu,timer) {
				this.x = x;
				this.y = y;
				this.w = w;
				this.h = h;
				this.count = count;
				this.bg = bg;
				this.sudu = sudu;
				var a = this.a = document.createElement("div");
				var e = this.e = a.style;
				e.position = "absolute";
				e.left = x + "px";
				e.top = y + "px";
				e.background = "url(" + bg + ")";
				e.width = w + "px";
				e.height = h / count + "px";
				document.body.appendChild(a);
				var bgy = 0;
				var timer = setInterval(function() {
					bgy = bgy - parseInt(e.height);
					if(bgy == -parseInt(e.height) * count / 2) {
						bgy = 0;
					}
					e.background = "url(" + bg + ")0px " + bgy + "px";
					e.left = parseInt(e.left) + sudu+ "px";
				}, timer);

			}
			window.onload = function() {
				var youdong = new fish(20, 20, 55, 296, 8, "fish1.png",10,800);
				var youdong1 = new fish(20, 80, 174, 1512, 12, "fish8.png",8,700);
				var youdong2 = new fish(20, 200, 166, 2196, 12, "fish9.png",6,600);
				var youdong3 = new fish(20, 400, 178, 1870, 10, "fish10.png",4,500);
			}
		</script>
	</body>

</html>